package org.ctsi.rsds.base.dao;

import org.springframework.dao.DataAccessException;

import java.io.Serializable;
import java.util.List;


public interface GenericDao<E,PK extends Serializable>{

	E getById(PK id) throws DataAccessException;

	int deleteById(PK id) throws DataAccessException;
	
	/** 插入数据 */
	int save(E entity) throws DataAccessException;
	
	/** 更新数据 */
	int update(E entity) throws DataAccessException;

	boolean isUnique(E entity, String uniquePropertyNames) throws DataAccessException;
	
	/** 用于hibernate.flush() 有些dao实现不需要实现此类  */
	void flush() throws DataAccessException;
	
	List<E> findAll() throws DataAccessException;
}
